<template>
  <view>
    <view class="u-page">

        <view class="con"> 
            <u-search placeholder="请输入关键词" v-model="keyword" shape="square" bgColor="#fff"></u-search>

            <view class="r-item" v-for="(item,index) in rList" :key="index">
                <view class="nr">
                <view class="wenzi">
                    <view class="shux">所属工地：</view>
                    <view class="val">{{item.ssgd}}</view>
                </view>
                <view class="wenzi">
                    <view class="shux">打卡时间：</view>
                    <view class="val">{{item.dksj}}</view>
                </view>
                <view class="wenzi">
                    <view class="shux">打卡地址：</view>
                    <view class="val">{{item.dkdz}}</view>
                </view>

                </view>
            </view>
        </view>
    </view>
    <mytabbar v-if="characterType"></mytabbar>
  </view>
</template>
<script>
import { mapState, mapMutations } from "vuex";
import sceneMixins from "@/utils/sceneMixins";
import mytabbar from "@/components/tabbar/index.vue";
export default {
  options: { styleIsolation: "shared" },
  components: { mytabbar: mytabbar },
  mixins: [sceneMixins],
  computed: {
    ...mapState(["userInfo", "openId", "token", "characterType"]),
  },
  data() {
    return {
        keyword:'',
        rList:[
            {ssgd:'青阳工地1',dksj:'2022.10.25  12:04:30',dkdz:'江苏省无锡市江阴市迎秀路161号'},
            {ssgd:'青阳工地1',dksj:'2022.10.25  12:04:30',dkdz:'江苏省无锡市江阴市迎秀路161号'},
            {ssgd:'青阳工地1',dksj:'2022.10.25  12:04:30',dkdz:'江苏省无锡市江阴市迎秀路161号'},
        ]
    };
  },

  methods: {
    ...mapMutations(["changeTab", "changeCharacterType"]),
  },
  onShow() {
    var vm = this;
    vm.waitVariable("token").then(() => {
      if (vm.userInfo) {
        var characterType = vm.userInfo.characterType;
        vm.changeCharacterType(characterType);
        if (characterType == 1) {
          vm.getAndLoad('首页', vm.WX_ASSETS + '/wxJSON/首页配置/建管.json', function (data) {
              vm.topAds = data.topAds.map(n => vm.getFmtImage(n));
              vm.menuList = data.menuList;
              console.log("🚀 ~ file: index.vue ~ line 95 ~ data.menuList", data.menuList)
          })
        } else {
          vm.getAndLoad('首页', vm.WX_ASSETS + '/wxJSON/首页配置/参建.json', function (data) {
            vm.topAds = data.topAds.map(n => vm.getFmtImage(n));
              vm.menuList = data.menuList;
          })
        }
      } else {
        uni.redirectTo({url: '/pages/mine/login'});
      }      
    })
  },
  onLoad(options) {
    },
};
</script>

<style lang="scss" scoped>
.u-page {
  height: 100vh;
  overflow: hidden;
  background: #f3f5f7;
}
.con{
    width: 90vw;
    margin: 0 auto;
    .r-item{
        width: 100%;
        height: 200rpx;
	background-color: #ffffff;
	border-radius: 25rpx;
    margin: 20rpx auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        .nr{
            width: 90%;
            margin: 0 auto;
        }
        .wenzi{
            display: flex;
            margin: 10rpx auto;
            .shux{
                font-size: 24rpx;
                color: #a5a5a5;
            }
            .val{
                font-size: 24rpx;
                color: #000
            }
        }
    }
}

</style>
